package com.pro01.apirednote.pojo;

import lombok.Data;

import java.time.LocalDateTime;

@Data
public class Content {
    private Long id;
    private Long userId;
    private String title;
    private String type; // IMAGE / VIDEO / DOC
    private String description;
    private Integer likeCount;
    private Integer commentCount;
    private Integer viewCount;
    private Boolean isDeleted;
    private LocalDateTime createdAt;
    private LocalDateTime updatedAt;
    
    // 用于全文搜索的字段，不存储在数据库中
    private transient String searchText;
    
    // 生成搜索文本
    public String getSearchText() {
        if (searchText == null) {
            StringBuilder sb = new StringBuilder();
            if (title != null) sb.append(title).append(" ");
            if (description != null) sb.append(description);
            searchText = sb.toString().trim();
        }
        return searchText;
    }
}
